<?php
include 'connectdb.php';

function isAdmin($user, $pass) {   
   $result = mysql_query("select * from admin");
   while ($rows = mysql_fetch_array($result)) {
      if (($user == $rows['username']) && ($pass == $rows['password'])) {
         return 2;
      }
   }   
   return 0;
}

function is_product($code) {   
   $result = mysql_query("SELECT * from product where code = '".$code."'");
   return mysql_num_rows($result);   
}

function is_seller($code) {   
   $result = mysql_query("SELECT * from seller where code = '".$code."'");
   return mysql_num_rows($result);   
}

function is_customer($code) {   
   $result = mysql_query("SELECT * from customer where code = '".$code."'");
   return mysql_num_rows($result);   
}
?>